<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	  xmlns:h="http://xmlns.jcp.org/jsf/html"
      xmlns:p="http://primefaces.org/ui"
      xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
      xmlns:f="http://xmlns.jcp.org/jsf/core">

<h:head>
	<title>Personalizzazione Pacchetto</title>
	<h:outputStylesheet library="TdTheme" name="css/style.css"/> 	
</h:head>

<h:body>
	<h:form>      
	    <p:menubar>
	    	<p:menuitem value="Homepage" icon="ui-icon-contact" url="home.xhtml?faces-redirect=true"/> 
	         
	        <f:facet name="options">
	        	<p:outputLabel value="Benvenuto, #{utenteManagedBean.nome}" style="margin-right:10px"/>  
	            <p:commandButton value="Modifica Profilo" icon="ui-icon-contact" action="modifica_utente.xhtml?faces-redirect=true"/>
	            <p:commandButton value="Logout" icon="ui-icon-extlink" action="#{loginManagedBean.logout()}"/>  
	        </f:facet>  
	    </p:menubar>  
  	</h:form>
	<p:panel>
		<h:form id="search_form">
			<h2 style="margin-left:auto; margin-right:auto;">Scegli la data di partenza</h2>
			<p:dataTable id="voli_andata" var="d" value="#{personalizzazioneManagedBean.res.originante.date_possibili}">
				<p:column headerText="Date di partenza possibili">
                 	<p:outputLabel value="#{d.data}">
                 		<f:convertDateTime pattern="dd/MM/yyyy" timeZone="Europe/Rome"/>
                 	</p:outputLabel>
             	</p:column>
             		
             	<p:column>
             		<p:commandButton style="width:300px;" value="Seleziona Data" action="#{personalizzazioneManagedBean.setDataAndRefresh(d)}" disabled="#{personalizzazioneManagedBean.res.dataPartenza != null}" rendered="#{personalizzazioneManagedBean.res.dataPartenza != d.data}">
             		</p:commandButton>
             		<p:commandButton style="width:300px;" value="Deseleziona Data" action="#{personalizzazioneManagedBean.setDataAndRefresh(null)}" rendered="#{personalizzazioneManagedBean.res.dataPartenza == d.data}">
             		</p:commandButton>
             	</p:column>
           	</p:dataTable>
            <p:messages autoUpdate="true"/>
            <p:commandButton id="indietro_btn" value="Indietro" styleClass="ui-priority-primary" action="dettagli_pacchetto.xhtml"/>
			<p:commandButton id="prosegui_btn" value="Prosegui" styleClass="ui-priority-primary" action="personalizzazione1.xhtml" disabled="#{personalizzazioneManagedBean.res.dataPartenza == null}"/>
		</h:form>
	</p:panel>
</h:body>
</html>